package java63;

public class work11_15_4 {
	public static int calc(int m, int n, int k) {
		boolean flag = false;
		int i = 10, finalNum = 0;
		if (k % m == 0 && k % n == 0) { // 如 1 1 1
			finalNum = k;
		} else {
			while (!flag) {
				int avgNum = i + k; // 保证个位数为k
				if (avgNum % m == 0 && avgNum % n == 0) { // 如 1 1 1
					finalNum = avgNum;
					break;
				}
				i = i + 10;
			}
		}
		return finalNum;
	}

	public static void main(String[] args) {
		// 7 7 6
		System.out.println(calc(3, 7, 1));
	}
}
